/**
 * @description 通过指定选择器获取对应的函数节点
 * @param {string} Selector 选择器
 * @returns 函数节点
 */

module.exports = {
	$(Selector) {
		let nodeList = document.querySelectorAll(Selector);
		if (nodeList.length === 0) {
			return console.warn(`${Selector}没有获取节点`);
		}
		if (nodeList.length === 1) {
			return nodeList[0];
		}
		if (nodeList.length > 1) {
			return nodeList;
		}
	},

	//底部导航tabbar
	tabbar(filename) {
		let html = `
            <a href="index.html" class="${
							filename === "index" ? "active" : ""
						}"><i class="iconfont icon-home"></i>首页</a>
            <a href="sports.html" class="${
							filename === "sports" ? "active" : ""
						}"><i class="iconfont icon-sports"></i>运动</a>
            <a href="circle.html" class="${
							filename === "circle" ? "active" : ""
						}"><i class="iconfont icon-circle"></i>圈子</a>
            <a href="mine.html" class="${
							filename === "mine" ? "active" : ""
						}"><i class="iconfont icon-mine"></i>我的</a>
        `;

		this.get(".tabbar").innerHTML = html;
	},
};
